import 'package:gameplay_flutter/generated/json/base/json_convert_content.dart';
import 'package:gameplay_flutter/lib_basemodel/discover/discover_topic_entity.dart';

DiscoverTopicEntity $DiscoverTopicEntityFromJson(Map<String, dynamic> json) {
  final DiscoverTopicEntity discoverTopicEntity = DiscoverTopicEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    discoverTopicEntity.id = id;
  }
  final String? description = jsonConvert.convert<String>(json['description']);
  if (description != null) {
    discoverTopicEntity.description = description;
  }
  final int? delFlag = jsonConvert.convert<int>(json['delFlag']);
  if (delFlag != null) {
    discoverTopicEntity.delFlag = delFlag;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    discoverTopicEntity.updateTime = updateTime;
  }
  final int? weight = jsonConvert.convert<int>(json['weight']);
  if (weight != null) {
    discoverTopicEntity.weight = weight;
  }
  final String? img = jsonConvert.convert<String>(json['img']);
  if (img != null) {
    discoverTopicEntity.img = img;
  }
  final int? userNum = jsonConvert.convert<int>(json['userNum']);
  if (userNum != null) {
    discoverTopicEntity.userNum = userNum;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    discoverTopicEntity.createTime = createTime;
  }
  final int? num = jsonConvert.convert<int>(json['num']);
  if (num != null) {
    discoverTopicEntity.num = num;
  }
  final int? recommentFlag = jsonConvert.convert<int>(json['recommentFlag']);
  if (recommentFlag != null) {
    discoverTopicEntity.recommentFlag = recommentFlag;
  }
  final int? enableFlag = jsonConvert.convert<int>(json['enableFlag']);
  if (enableFlag != null) {
    discoverTopicEntity.enableFlag = enableFlag;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    discoverTopicEntity.name = name;
  }
  final int? categoryId = jsonConvert.convert<int>(json['categoryId']);
  if (categoryId != null) {
    discoverTopicEntity.categoryId = categoryId;
  }
  return discoverTopicEntity;
}

Map<String, dynamic> $DiscoverTopicEntityToJson(DiscoverTopicEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['description'] = entity.description;
  data['delFlag'] = entity.delFlag;
  data['updateTime'] = entity.updateTime;
  data['weight'] = entity.weight;
  data['img'] = entity.img;
  data['userNum'] = entity.userNum;
  data['createTime'] = entity.createTime;
  data['num'] = entity.num;
  data['recommentFlag'] = entity.recommentFlag;
  data['enableFlag'] = entity.enableFlag;
  data['name'] = entity.name;
  data['categoryId'] = entity.categoryId;
  return data;
}

extension DiscoverTopicEntityExtension on DiscoverTopicEntity {
  DiscoverTopicEntity copyWith({
    int? id,
    String? description,
    int? delFlag,
    String? updateTime,
    int? weight,
    String? img,
    int? userNum,
    String? createTime,
    int? num,
    int? recommentFlag,
    int? enableFlag,
    String? name,
    int? categoryId,
  }) {
    return DiscoverTopicEntity()
      ..id = id ?? this.id
      ..description = description ?? this.description
      ..delFlag = delFlag ?? this.delFlag
      ..updateTime = updateTime ?? this.updateTime
      ..weight = weight ?? this.weight
      ..img = img ?? this.img
      ..userNum = userNum ?? this.userNum
      ..createTime = createTime ?? this.createTime
      ..num = num ?? this.num
      ..recommentFlag = recommentFlag ?? this.recommentFlag
      ..enableFlag = enableFlag ?? this.enableFlag
      ..name = name ?? this.name
      ..categoryId = categoryId ?? this.categoryId;
  }
}